<?php
if(!defined('INCLUDE')) exit();

// Global configuration
//======================

// Always use strict coding
error_reporting(E_ALL | E_STRICT);
date_default_timezone_set('Australia/Sydney');

// Windows compatibility
define('OS_PATH_SEPARATOR', '/');

// Seed for any hashing
define('HASH_SEED', 'R4Nd0|v|533D');

// Metadata configuration
//========================
// Note: Theses parameters are used during the parsing, not on the viewing

// Do we include extensions as metadata (default:true)
define('INCLUDE_EXTENSION_IN_METADATA', true);

// Minimum metadata length (default:2)
// Note: If you set this value up than 3 you're going to remove extensions metadata as well
define('MINIMUM_METADATA_LENGTH', 2); 

// Remove numeric only metadata (default:true)
// Theses metadata are not very useful
define('NO_NUMERIC_TAGS', true);

// Metadata blacklist is an array of blacklisted metadata (prepositions for exemple)
$METADATA_BLACKLIST = array(
	'the','on','to','in',
);

// Thumbnails configuration
//==========================

// X (width) and Y (height) size (default:128,128)
define('THUMBNAIL_X', 128);
define('THUMBNAIL_Y', 128);

// JPEG thumbnail quality (default:80)
define('THUMBNAIL_QUALITY', 80);

// Database configuration
//========================

// Database SQLite file
define('DATABASE', 'phplister3.sqlite');

// Table prefix
define('SQL_PREFIX', '');

// Counter type prefix
define('COUNTER_TYPE_NAME', 'type_');

// SQL tables names
define('ITEM_TABLE',      SQL_PREFIX.'item');
define('META_TABLE',      SQL_PREFIX.'meta');
define('ITEM_META_TABLE', SQL_PREFIX.'item_meta');

// Items per page, 18 is a good compromise
define('ITEM_PER_PAGE', 18);

// Uplaod plugin configuration
//=============================
define('UPLOAD_PLUGINS_DEFAULT', 'iframeform');

// File types configuration
//==========================

define('OTH', 1); // OTHER (is default)
define('DOC', 2); // DOCUMENTS
define('AUD', 3); // AUDIO
define('VID', 4); // VIDEO
define('IMG', 5); // IMAGE
$TYPE_LIST = array(AUD, VID, IMG, DOC, OTH);

// File types extensions detection
$TYPE = array();
$TYPE[IMG] = array('gif','jpeg','xcf','ico','tif','tiff','png','jpg','bmp');
$TYPE[VID] = array('wm','asx','asf','dv','mov','wmv','mp4','rm','qt','avi','movie','3gp','mp2','mpeg','mpg');
$TYPE[DOC] = array('pps','ppt','dot','cpt','sxd','sxc','pdf','mdb','eps','ai','ps','odh','odi','ods','odp','odm','odf','odc','doc','xls','tex','odg','odt','phps','psd','php3','php','latex','php5','php4','phtml','text','rtf','rtx','sxi','cdr','gnumeric','sxw','txt');
$TYPE[AUD] = array('ogg','mp3','m3u','mid','wma','ra','sd2','midi','aiff','wav','aif');
//array('gz','tgz','deb','iso','jar','taz','gtar','tar','rar','zip','rpm');

// Type names and ids
$typesTemplate = array(
	array('name' => 'Images',    'id' => IMG, 'class' => 'images'),
	array('name' => 'Documents', 'id' => DOC, 'class' => 'documents'),
	array('name' => 'Videos',    'id' => VID, 'class' => 'videos'),
	array('name' => 'Audio',     'id' => AUD, 'class' => 'audio'),
	array('name' => 'Other',     'id' => OTH, 'class' => 'other'),
);

// Directories configuration
//===========================

define('PLUGINS_DIRECTORY', 'plugins');
define('LIBS_DIRECTORY', 'libs');
define('METADATA_PLUGINS_DIRECTORY',  PLUGINS_DIRECTORY.OS_PATH_SEPARATOR.'metadata');
define('UPLOAD_PLUGINS_DIRECTORY',    PLUGINS_DIRECTORY.OS_PATH_SEPARATOR.'upload');
define('THUMBNAIL_PLUGINS_DIRECTORY', PLUGINS_DIRECTORY.OS_PATH_SEPARATOR.'thumbnail');
define('CORE_DIRECTORY', 'core');
define('UPLOAD_DIRECTORY', 'upload');
define('CACHE_DIRECTORY', 'cache');
define('THUMBNAIL_DIRECTORY', CACHE_DIRECTORY.OS_PATH_SEPARATOR.'thumbnails');
define('THUMBNAIL_CACHE_DIRECTORY', THUMBNAIL_DIRECTORY);
define('TEMPLATES_DIRECTORY', 'templates');
define('TEMPLATES_CACHE_DIRECTORY', CACHE_DIRECTORY.OS_PATH_SEPARATOR.'templates');
define('THEME_DIRECTORY', 'images');

// Debug configuration
//=====================

// Debug scope is INFO by default (see jglib debugging part)
require_once LIBS_DIRECTORY.OS_PATH_SEPARATOR.'jglib'.OS_PATH_SEPARATOR.'debugScopes.php';

// Debug level see debugScopes.php
define('DEBUG', false);
//define('DEBUG', JGLIB_DEBUG_INFO ^ JGLIB_DEBUG_SQLQ);//JGLIB_DEBUG_EALL ^ JGLIB_DEBUG_CACH ^ JGLIB_DEBUG_SQLR);

// Script timer
define('TIMER', false); 
// Note: To enable the timer while it's debug mode makes no sens because debug slow down all the script

// Debug message output
define('JGLIB_DEBUG_HTML', true); // show debug message as HTML

// Smarty configuration
//======================

// 0 = no caching, 1 = use class cache_lifetime value, 2 = use cache_lifetime in cache file
define('SMARTY_CACHING', 0);

// Cache life time in seconds
define('SMARTY_CACHE_LIFETIME', 3600);
define('SMARTY_DEBUG_CONSOLE', false);

// JGLib configuration
//=====================

// DO NOT MODIFY AFTER THIS LINE
require_once LIBS_DIRECTORY.OS_PATH_SEPARATOR.'jglib'.OS_PATH_SEPARATOR.'jglib.php';
require_once LIBS_DIRECTORY.OS_PATH_SEPARATOR.'jglib'.OS_PATH_SEPARATOR.'scandirr.php';
require_once LIBS_DIRECTORY.OS_PATH_SEPARATOR.'jglib'.OS_PATH_SEPARATOR.'timer.php';

$timer = null;
$timer2 = new Timer();
if((bool)TIMER)
{
	$timer = new Timer();
}

function debug($value, $message = '', $scope = JGLIB_DEBUG_INFO, &$output = null)
{
	global $timer;
	$value = JGLib::debug($value, $message, $scope, &$output);
	if(!is_null($timer))
	{
		$timer->addTimer($message);
	}
	return $value;
}

function redirect($l)
{
	return JGLib::redirect($l);
}

function isForeachable($element)
{
	return JGLib::isForeachable($element);
}

// Minimum JGLib version is 20080620
if(JGLib::$VERSION < 20080620) die('jglib version error.');

